/**
 * @file turn.h
 * @brief
 * @author xuesong (wenshaoliu@foxmail.com)
 * @version 1.0
 * @date 2024-09-11
 *
 * @copyright Copyright (c) 2024  by xuesong
 *
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version <th>Author  <th>Description
 * <tr><td>2024-09-11     <td>1.0     <td>xuesong   <td>内容
 * </table>
 */

#ifndef _TURN_H_
#define _TURN_H_

#ifdef __cplusplus
extern "C"
{
#endif
// #include "types.h"
#include <stdint.h>

    /* 中断类型 */
    typedef enum
    {
        INT_A_DN,
        INT_A_UP,
        INT_B_DN,
        INT_B_UP,
        INT_BH_ADN,
        INT_BH_ADP,
        INT_AH_BDN,
        INT_AH_BDP,
    } IntTrigDef;
#define INT_TRIG_MASK_BITS 0x03
#define INT_TRIG_MASK 0x07

    typedef uint32_t TurnStepAction_t;
    typedef uint8_t TurnStepFlag_t;

    typedef struct
    {
        union
        {
            struct
            {
                unsigned char Fifo2Bits00 : 3;
                unsigned char Fifo2Bits01 : 3;
                unsigned char Fifo2Bits02 : 3;
                unsigned char Fifo2Bits03 : 3;
                unsigned char Fifo2Bits04 : 3;
                unsigned char Fifo2Bits05 : 3;
                unsigned char Fifo2Bits06 : 3;
                unsigned char Fifo2Bits07 : 3;
            } Fifo2Bits;
            TurnStepAction_t Action;
        } actionFifo;
        TurnStepFlag_t flag;
    } TurnStepStruct;

    extern uint16_t turnCnt;

    void jumpActionCnt(void);

#ifdef __cplusplus
}
#endif

#endif
